package com.tanhua.server.controller;

import com.tanhua.model.vo.PeachblossomVo;
import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @auther : 白月尘
 * @date : 8:37  2021/11/1
 */
@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;


    //发送桃花传音
    @PostMapping
    public ResponseEntity sendPeachblossom(MultipartFile soundFile) {
        peachblossomService.sendPeachblossom(soundFile);
        return ResponseEntity.ok(null);
    }

    //接收桃花传音
    @GetMapping
    public ResponseEntity recivePeachblossom() {
        PeachblossomVo vo = peachblossomService.recivePeachblossom();
        return ResponseEntity.ok(vo);
    }
}